package cn.iocoder.yudao.module.promotion.service.prizedraw;

import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawSettingProductPageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawSettingProductRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawSettingProductSaveReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.prizedraw.PrizeDrawSettingBatchDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.prizedraw.PrizeDrawSettingProductDO;
import cn.iocoder.yudao.module.promotion.dal.mysql.prizedraw.PrizeDrawSettingBatchMapper;
import cn.iocoder.yudao.module.promotion.dal.mysql.prizedraw.PrizeDrawSettingProductMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.PRIZE_DRAW_SETTING_PRODUCT_NOT_EXISTS;

/**
 * 抽奖设置商品 Service 实现类
 *
 * @author 芋道源码
 */
@Service
@Validated
public class PrizeDrawSettingProductServiceImpl extends ServiceImpl<PrizeDrawSettingProductMapper, PrizeDrawSettingProductDO> implements PrizeDrawSettingProductService {

    @Resource
    private PrizeDrawSettingProductMapper prizeDrawSettingProductMapper;


    /**
     * 根据批次ID获取商品列表
     *
     * @param batchId 批次ID
     * @return 商品列表
     */
    @Override
    public List<PrizeDrawSettingProductRespVO> getProductsByBatchId(Long batchId) {
        return baseMapper.getProductsByBatchId(batchId);
    }

    /**
     * 根据批次IDS获取数引商品IDS
     *
     * @param batchIds 批次ID
     * @return 商品列表
     */
    @Override
    public List<Long> getProductsByBatchIds(List<Long> batchIds) {
        return baseMapper.getProductsByBatchIds(batchIds);
    }
}